package com.mes.basicdata.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.common.domain.BasicModel;

/**
 * <p>
 * 工艺变更内容
 * 
 * </p>
 * 
 */

@Entity()
@Table(name = "B_ECO_DETAIL")
@BatchSize(size=20)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class EngineeringChangeDetail extends BasicModel implements
		java.io.Serializable {

	public final static String EC_TYPE_ADD= "1"; // 添加
	public final static String EC_TYPE_UPDATE= "2"; // 修改
	public final static String EC_TYPE_DELETE = "3"; // 删除
	public final static String EC_TYPE_GROUP = "4"; // 工序集中加工
	public final static String EC_TYPE_CHANGESEQ = "5"; // 工序改变顺序
	
	@Id
	@GenericGenerator(name = "UNIQUEID", strategy = "assigned")
	@Column(name="UNIQUEID",unique=true)
	private String uniqueId;
	
	@Column(name="CHANGEUID")
	private String changeUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="CHANGEUID",insertable=false,updatable=false)
	private EngineeringChange engineeringChange;
		
	@Column(name="SEQ")
	private Integer seq;
	
	@Column(name="CHANGETYPE")
	private String changeType;
	
	private TypesData changeTypeDesc;
	
	@Column(name="FROMOPUID")
	private String fromOperationUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="FROMOPUID",insertable=false,updatable=false)
	private Operation fromOperation;
	
	@Column(name="FROMOPIDDESC")
	private String fromOperationIdDesc;
	
	@Column(name="FROMOPNAME")
	private String fromOperationName;
	
	@Column(name="FROMOPVERSIONID")
	private String fromOperationVersionId;
	
	@Column(name="TOOPUID")
	private String toOperationUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="TOOPUID",insertable=false,updatable=false)
	private Operation toOperation;	
	
	@Column(name="TOOPIDDESC")
	private String toOperationIdDesc;	
	
	@Column(name="TOOPNAME")
	private String toOperationName;
	
	@Column(name="TOOPVERSIONID")
	private String toOperationVersionId;
	
	@Column(name="MODIFYCONTENT")
	private String modifyContent;//修改内容描述
	
	@Column(name="MODIFYREASON")
	private String modifyReason;//修改原因
	
	@Column(name="PREDOPUID")
	private String predOperationUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="PREDOPUID",insertable=false,updatable=false)
	private Operation predOperation;	
	
	@Column(name="PREDOPUIDDESC")
	private String predOperationIdDesc;
	
	@Column(name="SUCCOPUID")
	private String succOperationUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="SUCCOPUID",insertable=false,updatable=false)
	private Operation succOperation;	
	
	@Column(name="SUCCOPUIDDESC")
	private String succOperationIdDesc;
	


//	private String fromOperationOutUid;
//	private String toOperationOutUid;
	
	
	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getChangeUid();
	}
	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setChangeUid(uuid);
	}
	
	public String getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(String uniqueId) {
		this.uniqueId = uniqueId;
	}

	public String getChangeUid() {
		return changeUid;
	}

	public void setChangeUid(String changeUid) {
		this.changeUid = changeUid;
	}

	public EngineeringChange getEngineeringChange() {
		return engineeringChange;
	}

	public void setEngineeringChange(EngineeringChange engineeringChange) {
		this.engineeringChange = engineeringChange;
	}

	public Integer getSeq() {
		return seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}

	public String getChangeType() {
		return changeType;
	}

	public void setChangeType(String changeType) {
		this.changeType = changeType;
	}

	public String getFromOperationUid() {
		return fromOperationUid;
	}

	public void setFromOperationUid(String fromOperationUid) {
		this.fromOperationUid = fromOperationUid;
	}

	public Operation getFromOperation() {
		return fromOperation;
	}

	public void setFromOperation(Operation fromOperation) {
		this.fromOperation = fromOperation;
	}

	public String getFromOperationIdDesc() {
		return fromOperationIdDesc;
	}

	public void setFromOperationIdDesc(String fromOperationIdDesc) {
		this.fromOperationIdDesc = fromOperationIdDesc;
	}

	public String getFromOperationName() {
		return fromOperationName;
	}

	public void setFromOperationName(String fromOperationName) {
		this.fromOperationName = fromOperationName;
	}

	public String getFromOperationVersionId() {
		return fromOperationVersionId;
	}

	public void setFromOperationVersionId(String fromOperationVersionId) {
		this.fromOperationVersionId = fromOperationVersionId;
	}

	public String getToOperationUid() {
		return toOperationUid;
	}

	public void setToOperationUid(String toOperationUid) {
		this.toOperationUid = toOperationUid;
	}

	public Operation getToOperation() {
		return toOperation;
	}

	public void setToOperation(Operation toOperation) {
		this.toOperation = toOperation;
	}

	public String getToOperationIdDesc() {
		return toOperationIdDesc;
	}

	public void setToOperationIdDesc(String toOperationIdDesc) {
		this.toOperationIdDesc = toOperationIdDesc;
	}

	public String getToOperationName() {
		return toOperationName;
	}

	public void setToOperationName(String toOperationName) {
		this.toOperationName = toOperationName;
	}

	public String getToOperationVersionId() {
		return toOperationVersionId;
	}

	public void setToOperationVersionId(String toOperationVersionId) {
		this.toOperationVersionId = toOperationVersionId;
	}

	public String getModifyContent() {
		return modifyContent;
	}

	public void setModifyContent(String modifyContent) {
		this.modifyContent = modifyContent;
	}

	public String getModifyReason() {
		return modifyReason;
	}

	public void setModifyReason(String modifyReason) {
		this.modifyReason = modifyReason;
	}

	public String getPredOperationUid() {
		return predOperationUid;
	}

	public void setPredOperationUid(String predOperationUid) {
		this.predOperationUid = predOperationUid;
	}

	public Operation getPredOperation() {
		return predOperation;
	}

	public void setPredOperation(Operation predOperation) {
		this.predOperation = predOperation;
	}

	public String getPredOperationIdDesc() {
		return predOperationIdDesc;
	}

	public void setPredOperationIdDesc(String predOperationIdDesc) {
		this.predOperationIdDesc = predOperationIdDesc;
	}

	public String getSuccOperationUid() {
		return succOperationUid;
	}

	public void setSuccOperationUid(String succOperationUid) {
		this.succOperationUid = succOperationUid;
	}

	public Operation getSuccOperation() {
		return succOperation;
	}

	public void setSuccOperation(Operation succOperation) {
		this.succOperation = succOperation;
	}

	public String getSuccOperationIdDesc() {
		return succOperationIdDesc;
	}

	public void setSuccOperationIdDesc(String succOperationIdDesc) {
		this.succOperationIdDesc = succOperationIdDesc;
	}

	public TypesData getChangeTypeDesc() {
		return changeTypeDesc;
	}

	public void setChangeTypeDesc(TypesData changeTypeDesc) {
		this.changeTypeDesc = changeTypeDesc;
	}
	

	
	



}